home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / f1 / func3d.arj / FUENTE / FUNCDLG.CP_ / FUNCDLG.CP
Encoding:
Text File  |  1994-05-10  |  17.5 KB  |  711 lines

  1. //
  2. //   Fichero: FUNCDLG.CPP
  3. //
  4. //   Versi≤n: 1.0
  5. //     Autor: Antonio M. EstΘvez Lorenzo
  6. // Prop≤sito: Cuadros de dißlogo de la aplicaci≤n
  7. //
  8.  
  9. #include <windows.h>
  10. #include <owl.h>
  11. #pragma hdrstop
  12.  
  13. #include "FuncDlg.h"
  14. #include "Strings.h"
  15. #include "Errores.ids"
  16. #include "Ayuda.ids"
  17. #include <BChkBox.h>
  18. #include <BRadio.h>
  19. #include <Edit.h>
  20. #include <ScrollBa.h>
  21.  
  22. #define NumDec  10
  23. #define NumEdit sizeof(MatEdit)/sizeof(MatEdit[0])
  24.  
  25.  
  26. /* TDlgEdit */
  27.  
  28. static int MatEdit[][2] = {{edNombre,LongFunc},
  29.     {edInfX,  LongReal}, {edSupX,  LongReal}, {edInfY,  LongReal},
  30.     {edSupY,  LongReal}, {edNodosX,LongInt},  {edNodosY,LongInt},
  31.     {edEscX,  LongReal}, {edEscY,  LongReal}, {edEscZ,  LongReal},
  32.     {edCoordX,LongReal}, {edCoordY,LongReal}, {edCoordZ,LongReal},
  33.     {edAngIniX,LongInt}, {edAngIniY,LongInt}, {edAngIniZ,LongInt}};
  34.  
  35. void TDlgEdit::CreaControl(BOOL embedded, BOOL cancel)
  36. {
  37.    Embedded= embedded;
  38.    Cancel  = cancel;
  39.    for(int i= 0; i< NumEdit; i++)
  40.       new TEdit(this, MatEdit[i][0], MatEdit[i][1]);
  41.    new TGroupBox(this, grDimen);
  42. }
  43.  
  44. void TDlgEdit::SetupWindow()
  45. {
  46.    TWindDlg::SetupWindow();
  47.    EnableWindow(GetDlgItem(HWindow,edNombre), !Embedded);
  48.    EnableWindow(GetDlgItem(HWindow,boCancel), Cancel);
  49.    if(!IsWindowVisible(Parent->HWindow))
  50.       EnableWindow(GetDlgItem(HWindow,boCalculadora), FALSE);
  51.  
  52.    HMENU hMenu= GetSystemMenu(HWindow, FALSE);
  53.    EnableMenuItem(hMenu, SC_CLOSE,
  54.                   MF_BYCOMMAND | (Cancel ? MF_ENABLED : MF_GRAYED));
  55. }
  56.  
  57. void TDlgEdit::FuncDef(RTMessage)
  58. {
  59.    RECT Rect1,Rect2;
  60.  
  61.    GetWindowRect(ChildWithId(grDimen)->HWindow, &Rect1);
  62.    GetWindowRect(HWindow, &Rect2);
  63.    GetModule()->ExecDialog(new TDlgFuncDef(this, Rect1.top-Rect2.top));
  64. }
  65.  
  66. void TDlgEdit::Calcula(RTMessage)
  67. {
  68.    HWND hWind= GetApplicationObject()->MainWindow->HWindow;
  69.    SendMessage(hWind, WM_COMMAND, cmCalculadora, NULL);
  70. }
  71.  
  72.  
  73. /* TDlgEditPar */
  74.  
  75. TDlgEditPar::TDlgEditPar(PTWindowsObject parent, TSuperfPar *Sup,
  76.                          BOOL embedded, BOOL cancel, PTModule module)
  77.             :TDlgEdit(parent, dgEditPar, module)
  78. {
  79.    new TEdit(this, edEcuX, LongFunc);
  80.    new TEdit(this, edEcuY, LongFunc);
  81.    new TEdit(this, edEcuZ, LongFunc);
  82.    CreaControl(embedded, cancel);
  83.  
  84.    Superf= Sup;
  85.    TransferBuffer= EcuPar= &Sup->Superf;
  86. }
  87.  
  88. BOOL TDlgEditPar::CanClose()
  89. {
  90.    TDatEcuPar DatTmp;
  91.  
  92.    TransferBuffer= &DatTmp;
  93.    TransferData(TF_GETDATA);
  94.    TransferBuffer= EcuPar;
  95.  
  96.    int Error= Superf->InitSuperf(&DatTmp);
  97.    if(Error)
  98.       Mensaje(HWindow,Error);
  99.    else
  100.       return TRUE;
  101.  
  102.    return FALSE;
  103. }
  104.  
  105.  
  106. /* TDlgEdit2V */
  107.  
  108. TDlgEdit2V::TDlgEdit2V(PTWindowsObject parent, TSuperf2V *Sup,
  109.                        BOOL embedded, BOOL cancel, PTModule module)
  110.            :TDlgEdit(parent, dgEdit2V, module)
  111. {
  112.    new TEdit(this, edFunc, LongFunc);
  113.    CreaControl(embedded, cancel);
  114.  
  115.    Superf= Sup;
  116.    TransferBuffer= Func2V= &Sup->Superf;
  117. }
  118.  
  119. BOOL TDlgEdit2V::CanClose()
  120. {
  121.    TDatFunc2V DatTmp;
  122.  
  123.    TransferBuffer= &DatTmp;
  124.    TransferData(TF_GETDATA);
  125.    TransferBuffer= Func2V;
  126.  
  127.    int Error= Superf->InitSuperf(&DatTmp);
  128.    if(Error)
  129.       Mensaje(HWindow, Error);
  130.    else
  131.       return TRUE;
  132.  
  133.    return FALSE;
  134. }
  135.  
  136.  
  137. /* TDlgCalcPar */ 
  138.  
  139. TDlgCalcPar::TDlgCalcPar(PTWindowsObject parent, TSuperf *Sup,
  140.                          TVarEcuPar *Var, PTModule module)
  141.             :TWindDlg(parent, dgCalcPar, module)
  142. {
  143.    new TEdit(this,edVarX, LongReal);
  144.    new TEdit(this,edVarY, LongReal);
  145.    new TStatic(this,edNumX, LongReal)->EnableTransfer();
  146.    new TStatic(this,edNumY, LongReal)->EnableTransfer();
  147.    new TStatic(this,edNumZ, LongReal)->EnableTransfer();
  148.    *Var->X= *Var->Y= *Var->Z= '\0';
  149.    TransferBuffer= Var;
  150.    varAB= Var;
  151.    Superf= Sup;
  152. }
  153.  
  154. void TDlgCalcPar::Calcular(RTMessage)
  155. {
  156.    RealStr strX, strY, strZ;
  157.    float X,Y,Z;
  158.  
  159.    TransferData(TF_GETDATA);
  160.  
  161.    if(CalculaReal(varAB->A, &Superf->varX) &&
  162.       CalculaReal(varAB->B, &Superf->varY) &&
  163.       Superf->Calcula(&X,&Y,&Z))
  164.    {
  165.       gcvt(X,NumDec,varAB->X);
  166.       gcvt(Y,NumDec,varAB->Y);
  167.       gcvt(Z,NumDec,varAB->Z);
  168.    }
  169.    else
  170.    {
  171.       *(char*)&varAB->X= NULL;
  172.       *(char*)&varAB->Y= NULL;
  173.       *(char*)&varAB->Z= NULL;
  174.    }
  175.    TransferData(TF_SETDATA);
  176.    SetFocus(ChildWithId(edVarX)->HWindow);
  177. }
  178.  
  179.  
  180. /* TDlgCalc2V */
  181.  
  182. TDlgCalc2V::TDlgCalc2V(PTWindowsObject parent, TSuperf *Sup,
  183.                        TVarFunc2V *Var, PTModule module)
  184.            :TWindDlg(parent, dgCalc2V, module)
  185. {
  186.    new TEdit(this,edVarX, LongReal);
  187.    new TEdit(this,edVarY, LongReal);
  188.    new TStatic(this,edNumX, LongReal)->EnableTransfer();
  189.    *Var->Z= '\0';
  190.    TransferBuffer= Var;
  191.    varXY= Var;
  192.    Superf= Sup;
  193. }
  194.  
  195. void TDlgCalc2V::Calcular(RTMessage)
  196. {
  197.    float X,Y,Z;
  198.  
  199.    TransferData(TF_GETDATA);
  200.  
  201.    if(CalculaReal(varXY->X, &Superf->varX) &&
  202.       CalculaReal(varXY->Y, &Superf->varY) &&
  203.       Superf->Calcula(&X,&Y,&Z))
  204.       gcvt(Z,NumDec,varXY->Z);
  205.    else
  206.       *(char*)&varXY->Z= NULL;
  207.    TransferData(TF_SETDATA);
  208.    SetFocus(ChildWithId(edVarX)->HWindow);
  209. }
  210.  
  211.  
  212. /* TDlgCalcula */
  213.  
  214. struct TDatCalcula
  215. {
  216.     char Func[LongFunc];
  217.     char Result[LongReal];
  218. } DatCalcula = {"",""};
  219.  
  220. TDlgCalcula::TDlgCalcula(PTWindowsObject parent, PTModule module)
  221.             :TWindDlg(parent, dgCalculadora, module)
  222. {
  223.    new TEdit(this, edFunc, LongFunc, module);
  224.    new TStatic(this, edResult, LongReal, module)->EnableTransfer();
  225.    TransferBuffer= &DatCalcula;
  226.    HMENU hMenu= GetMenu(parent->HWindow);
  227.    EnableMenuItem(hMenu, cmCalculadora, MF_BYCOMMAND | MF_GRAYED);
  228. }
  229.  
  230. TDlgCalcula::~TDlgCalcula()
  231. {
  232.    HMENU hMenu= GetMenu(Parent->HWindow);
  233.    EnableMenuItem(hMenu, cmCalculadora, MF_BYCOMMAND | MF_ENABLED);
  234. }
  235.  
  236. void TDlgCalcula::SetupWindow()
  237. {
  238.    TDialog::SetupWindow();
  239.  
  240.    RECT  ParWind,Wind;
  241.    POINT Coord;
  242.  
  243.    GetClientRect(Parent->HWindow, &ParWind);
  244.    GetClientRect(HWindow, &Wind);
  245.    Coord.x= ParWind.right - Wind.right - 1;
  246.    Coord.y= 0;
  247.    ClientToScreen(Parent->HWindow, &Coord);
  248.    MueveA(Coord.x, Coord.y);
  249. }
  250.  
  251. LPSTR TDlgCalcula::GetClassName()
  252. {
  253.    return "CALC";
  254. }
  255.  
  256. void TDlgCalcula::GetWindowClass(WNDCLASS &AWndClass)
  257. {
  258.    TWindDlg::GetWindowClass(AWndClass);
  259.    AWndClass.hIcon= LoadIcon(GetApplication()->hInstance,"calc");
  260. }
  261.  
  262. void TDlgCalcula::Minimizar(RTMessage Msg)
  263. {
  264.    RECT  Rect;
  265.    POINT Coord;
  266.    WINDOWPOS *Pos= (WINDOWPOS*)Msg.LParam;
  267.  
  268.    if((Pos->flags & SWP_SHOWWINDOW) &&
  269.      !(Pos->flags & SWP_NOMOVE))
  270.    {
  271.       GetClientRect(Parent->HWindow, &Rect);
  272.       Coord.x= Rect.right - 70;
  273.       Coord.y= 10;
  274.       ClientToScreen(Parent->HWindow, &Coord);
  275.       Pos->x= Coord.x;
  276.       Pos->y= Coord.y;
  277.    }
  278.    DefWndProc(Msg);
  279. }
  280.  
  281. void TDlgCalcula::Calcular(RTMessage)
  282. {
  283.    REAL Result;
  284.  
  285.    TransferData(TF_GETDATA);
  286.    if(CalculaReal(DatCalcula.Func, &Result))
  287.       gcvt(Result,NumDec,DatCalcula.Result);
  288.    else
  289.       *(char*)&DatCalcula.Result= '\0';
  290.    TransferData(TF_SETDATA);
  291.    SetFocus(ChildWithId(edFunc)->HWindow);
  292. }
  293.  
  294.  
  295. /* TDlgImprimir */
  296.  
  297. TDlgImprimir::TDlgImprimir(PTWindowsObject parent,
  298.                  TDatImpr *Dat, SIZE PageSize, PTModule module)
  299.         :TWindDlg(parent, dgImprimir, module)
  300. {
  301.    IntToSt(Dat->MaxX,PageSize.cx);
  302.    IntToSt(Dat->MaxY,PageSize.cy);
  303.    IntToSt(Dat->DimStrX,Dat->DimX);
  304.    IntToSt(Dat->DimStrY,Dat->DimY);
  305.  
  306.    TGroupBox *Grupo;
  307.  
  308.    Grupo= new TGroupBox(this,grPosVert);
  309.    new TBRadioButton(this,rb1,Grupo);
  310.    new TBRadioButton(this,rb2,Grupo);
  311.    new TBRadioButton(this,rb3,Grupo);
  312.    Grupo= new TGroupBox(this,grPosHorz);
  313.    new TBRadioButton(this,rb4,Grupo);
  314.    new TBRadioButton(this,rb5,Grupo);
  315.    new TBRadioButton(this,rb6,Grupo);
  316.    Grupo= new TGroupBox(this,grCoord);
  317.    new TBCheckBox(this,cb1,Grupo);
  318.    new TEdit(this,edCoordX, LongInt);
  319.    new TEdit(this,edCoordY, LongInt);
  320.    new TBCheckBox(this,cb2,NULL);
  321.    new TStatic(this,edNumX, LongInt)->EnableTransfer();
  322.    new TStatic(this,edNumY, LongInt)->EnableTransfer();
  323.    Grupo= new TGroupBox(this,grDimen);
  324.    new TEdit(this,edEscX, LongInt);
  325.    new TEdit(this,edEscY, LongInt);
  326.    new TBRadioButton(this,rbAncho,Grupo);
  327.    new TBRadioButton(this,rbAlto,Grupo);
  328.    TransferBuffer= DatImpr= Dat;
  329. }
  330.  
  331. void TDlgImprimir::Coord(RTMessage)
  332. {
  333.    BOOL Act;
  334.    int  i;
  335.  
  336.    Act= ((TBCheckBox*)ChildWithId(cb1))->GetCheck();
  337.    for(i= rb1; i<= rb6; i++)
  338.       EnableWindow(GetDlgItem(HWindow,i),!Act);
  339.    EnableWindow(GetDlgItem(HWindow,edCoordX),Act);
  340.    EnableWindow(GetDlgItem(HWindow,edCoordY),Act);
  341. }
  342.  
  343. void TDlgImprimir::Dimen(RTMessage)
  344. {
  345.    BOOL Act= ((TBCheckBox*)ChildWithId(rbAncho))->GetCheck();
  346.    EnableWindow(GetDlgItem(HWindow,edEscX),Act);
  347.    EnableWindow(GetDlgItem(HWindow,edEscY),!Act);
  348. }
  349.  
  350. BOOL TDlgImprimir::CanClose()
  351. {
  352.    TDatImpr Dat;
  353.    int CoordX, CoordY;
  354.    int DimX, DimY;
  355.  
  356.    TransferBuffer= &Dat;
  357.    TransferData(TF_GETDATA);
  358.    TransferBuffer= DatImpr;
  359.  
  360.    if(IntValido(Dat.CoordStrX,&CoordX,-20000,20000) &&
  361.       IntValido(Dat.CoordStrY,&CoordY,-20000,20000))
  362.       if(IntValido(Dat.DimStrX,&DimX,10,20000) &&
  363.          IntValido(Dat.DimStrY,&DimY,10,20000))
  364.       {
  365.          DatImpr->CoordX= CoordX;
  366.          DatImpr->CoordY= CoordY;
  367.          DatImpr->DimX= DimX;
  368.          DatImpr->DimY= DimY;
  369.          return TRUE;
  370.       }
  371.       else
  372.          Mensaje(HWindow,ErrorDimPag);
  373.    else
  374.       Mensaje(HWindow,ErrorCrdPrn);
  375.    return FALSE;
  376. }
  377.  
  378.  
  379. /* TDlgBmp */
  380.  
  381. #define LongEje 40
  382.  
  383. class TDlgBmp: public TStatic
  384. {
  385. protected:
  386.    virtual void Paint(HDC, PAINTSTRUCT _FAR &);
  387.    virtual LPSTR GetClassName();
  388. public:
  389.    TDlgBmp(PTWindowsObject parent, PTModule module= NULL)
  390.           :TStatic(parent, bmEjes, 0, module) {};
  391.    void Dibuja();
  392. };
  393.  
  394. static POINT Ejes[5];
  395. static TScrollBar *sbXZ, *sbYZ;
  396. static TStatic    *edXZ, *edYZ;
  397. static TDlgBmp    *BMap;
  398.  
  399.  
  400. LPSTR TDlgBmp::GetClassName()
  401. {
  402.   return "DLGBMP";
  403. }
  404.  
  405. void TDlgBmp::Paint(HDC, PAINTSTRUCT &)
  406. {
  407.    Dibuja();
  408. }
  409.  
  410. void TDlgBmp::Dibuja()
  411. {
  412.    int    XZ, YZ;
  413.    REAL   SinXZ, CosXZ, SinYZ, CosYZ;
  414.    IntStr Str;
  415.  
  416.    IntToSt(Str,XZ= sbXZ->GetPosition()); edXZ->SetText(Str);
  417.    IntToSt(Str,YZ= sbYZ->GetPosition()); edYZ->SetText(Str);
  418.    CalcAng(XZ, LongEje, SinXZ,CosXZ);
  419.    CalcAng(YZ, LongEje, SinYZ,CosYZ);
  420.  
  421.    int OrgX= Attr.W>>1;
  422.    int OrgY= Attr.H>>1;
  423.  
  424.    HDC  Hdc = GetDC(HWindow);
  425.    HRGN HRgn= CreateRectRgn(0,0,Attr.W-2,Attr.H-2);
  426.    SelectClipRgn(Hdc,HRgn);
  427.    PaintRgn(Hdc,HRgn);
  428.    Ejes[0].x= OrgX;
  429.    Ejes[0].y= OrgY-LongEje;
  430.    Ejes[2].x= OrgX-CosXZ;
  431.    Ejes[2].y= OrgY+SinXZ;
  432.    Ejes[4].x= OrgX+CosYZ;
  433.    Ejes[4].y= OrgY+SinYZ;
  434.    Ejes[1].x= Ejes[3].x= OrgX;
  435.    Ejes[1].y= Ejes[3].y= OrgY;
  436.  
  437.    HFONT hfont= (HFONT)SelectObject(Hdc,
  438.                      CreateFont(-9, 0, 0, 0, FW_BOLD,
  439.                                  0, 0, 0, 0, 0, 0, 0, 0, "BorlandTE"));
  440.    TextOut(Hdc,OrgX+3,OrgY-LongEje-8,"Z",1);
  441.    TextOut(Hdc,OrgX-CosXZ,OrgY+SinXZ,"X",1);
  442.    TextOut(Hdc,OrgX+CosYZ,OrgY+SinYZ,"Y",1);
  443.    DeleteObject(SelectObject(Hdc, hfont));
  444.    Polyline(Hdc,Ejes,5);
  445.    DeleteObject(HRgn);
  446.    ReleaseDC(HWindow,Hdc);
  447. }
  448.  
  449.  
  450. /* TDlgPersp */
  451.  
  452. TDlgPersp::TDlgPersp(PTWindowsObject parent, TSuperf *Sup, PTModule module)
  453.           :TWindDlg(parent, dgPersp, module)
  454. {
  455.    TGroupBox *Grupo;
  456.  
  457.    Grupo= new TGroupBox(this,grPersp);
  458.    new TBRadioButton(this,cmAxonom,Grupo);
  459.    new TBRadioButton(this,cmAlzado,Grupo);
  460.    new TBRadioButton(this,cmPerfil,Grupo);
  461.    new TBRadioButton(this,cmPlanta,Grupo);
  462.    new TBRadioButton(this,cmIsomet,Grupo);
  463.    new TBRadioButton(this,cmCaball,Grupo);
  464.    new TBCheckBox(this,cb1,Grupo);
  465.    Grupo= new TGroupBox(this,grCaballera);
  466.    new TBRadioButton(this,rbCR,Grupo);
  467.    new TBRadioButton(this,rbAP,Grupo);
  468.    new TEdit(this,edCabCoef, LongReal);
  469.    new TEdit(this,edCabAng, LongInt);
  470.    Grupo= new TGroupBox(this,grEje);
  471.    new TBRadioButton(this,cmEjeX,Grupo);
  472.    new TBRadioButton(this,cmEjeY,Grupo);
  473.    new TBRadioButton(this,cmEjeZ,Grupo);
  474.    new TBRadioButton(this,cmOtroEje,Grupo);
  475.    new TEdit(this,edIntvGiro, LongInt);
  476.    Grupo= new TGroupBox(this,grDibComo);
  477.    new TBRadioButton(this,rbMalla,Grupo);
  478.    new TBRadioButton(this,rbPuntos,Grupo);
  479.    new TBRadioButton(this,rbIntvX,Grupo);
  480.    new TBRadioButton(this,rbIntvY,Grupo);
  481.    sbXZ= new TScrollBar(this,sbAngXZ);
  482.    sbYZ= new TScrollBar(this,sbAngYZ);
  483.    edXZ= new TStatic(this,edAngXZ,LongInt);
  484.    edYZ= new TStatic(this,edAngYZ,LongInt);
  485.    BMap= new TDlgBmp(this);
  486.  
  487.    Superf= Sup;
  488.    TransferBuffer= tmpGraf= &Sup->Grafica;
  489.  
  490.    AngXZ = tmpGraf->AngXZ;
  491.    AngYZ = tmpGraf->AngYZ;
  492.    CabXZ = tmpGraf->CabXZ;
  493.    Caball= Axonom= FALSE;
  494.    if(!tmpGraf->TipoPersp[5])
  495.    {
  496.       Axonom= TRUE;
  497.       tmpGraf->PosAngXZ= AngXZ;
  498.       tmpGraf->PosAngYZ= AngYZ;
  499.    }
  500.    else
  501.    {
  502.       Caball= TRUE;
  503.       tmpGraf->PosAngXZ= CabXZ;
  504.       tmpGraf->PosAngYZ= 90;
  505.    }
  506. }
  507.  
  508. BOOL TDlgPersp::CanClose()
  509. {
  510.    TDatGrafica DatTmp;
  511.  
  512.    TransferBuffer= &DatTmp;
  513.    TransferData(TF_GETDATA);
  514.    TransferBuffer= tmpGraf;
  515.  
  516.    int Error= Superf->InitGrafica(&DatTmp);
  517.  
  518.    if(Error)
  519.    {
  520.       Mensaje(HWindow,Error);
  521.       return FALSE;
  522.    }
  523.    if(Axonom)
  524.    {
  525.       AngXZ= sbXZ->GetPosition();
  526.       AngYZ= sbYZ->GetPosition();
  527.    }
  528.    if(Caball)
  529.       CabXZ= sbXZ->GetPosition();
  530.  
  531.    tmpGraf->AngXZ= AngXZ;
  532.    tmpGraf->AngYZ= AngYZ;
  533.    tmpGraf->CabXZ= CabXZ;
  534.    return TRUE;
  535. }
  536.  
  537. void TDlgPersp::ScrollXZ(RTMessage)
  538. {
  539.    BMap->Dibuja();
  540. }
  541.  
  542. void TDlgPersp::ScrollYZ(RTMessage)
  543. {
  544.    BMap->Dibuja();
  545. }
  546.  
  547. void TDlgPersp::Caballera(RTMessage Msg)
  548. {
  549.    Grupo(Msg);
  550. }
  551.  
  552. void TDlgPersp::Grupo(RTMessage)
  553. {
  554.    int Act0,Act1,Act2,Act3,Act4,Act5;
  555.  
  556.    Act0= ((TBRadioButton*)ChildWithId(cmAxonom))->GetCheck();
  557.    Act1= ((TBRadioButton*)ChildWithId(cmCaball))->GetCheck();
  558.  
  559.    if(Act0 && !Axonom)
  560.    {
  561.       CabXZ= sbXZ->GetPosition();
  562.       sbXZ->SetPosition(AngXZ);
  563.       sbYZ->SetPosition(AngYZ);
  564.       Axonom= TRUE;
  565.       Caball= FALSE;
  566.       BMap->Dibuja();
  567.    }
  568.    if(Act1 && !Caball)
  569.    {
  570.       AngXZ= sbXZ->GetPosition();
  571.       AngYZ= sbYZ->GetPosition();
  572.       sbXZ->SetPosition(CabXZ);
  573.       sbYZ->SetPosition(90);
  574.       Axonom= FALSE;
  575.       Caball= TRUE;
  576.       BMap->Dibuja();
  577.    }
  578.  
  579.    Act3 = ((TRadioButton*)ChildWithId(rbCR))->GetCheck();
  580.    Act4 = ((TRadioButton*)ChildWithId(cmIsomet))->GetCheck();
  581.    Act5 = ((TRadioButton*)ChildWithId(cb1))->GetCheck();
  582.    Act2 = Act1 & Act5;
  583.    Act1|= Act0;
  584.  
  585.    EnableWindow(GetDlgItem(HWindow,sbAngXZ), Act1);
  586.    EnableWindow(GetDlgItem(HWindow,edAngXZ), Act1);
  587.    EnableWindow(GetDlgItem(HWindow,sbAngYZ), Act0);
  588.    EnableWindow(GetDlgItem(HWindow,edAngYZ), Act0);
  589.    EnableWindow(GetDlgItem(HWindow,rbCR), Act2);
  590.    EnableWindow(GetDlgItem(HWindow,rbAP), Act2);
  591.    EnableWindow(GetDlgItem(HWindow,edCabCoef),Act2 &  Act3);
  592.    EnableWindow(GetDlgItem(HWindow,edCabAng), Act2 & !Act3);
  593.    EnableWindow(GetDlgItem(HWindow,cb1), Act1 | Act4);
  594. }
  595.  
  596. void TDlgPersp::TipoEje(RTMessage)
  597. {
  598.    if(((TBRadioButton*)ChildWithId(cmOtroEje))->GetCheck())
  599.       GetModule()->ExecDialog(new TDlgEjeGiro(this,Superf));
  600. }
  601.  
  602.  
  603. /* TDlgEjeGiro */
  604.  
  605. TDlgEjeGiro::TDlgEjeGiro(PTWindowsObject parent, TSuperf *Sup, PTModule module)
  606.             :TWindDlg(parent, dgEjeGiro, module)
  607. {
  608.    TGroupBox *Grupo;
  609.  
  610.    for(int i= edPnt1X; i<= edEjeY; i++)
  611.       new TEdit(this, i, LongReal);
  612.  
  613.    new TBCheckBox(this,cb1,NULL);
  614.    Grupo= new TGroupBox(this,grEje);
  615.    new TBRadioButton(this,rb1,Grupo);
  616.    new TBRadioButton(this,rb2,Grupo);
  617.    new TBRadioButton(this,rb3,Grupo);
  618.    new TBRadioButton(this,rb4,Grupo);
  619.    new TStatic(this,edVarX,7);
  620.    new TStatic(this,edVarY,7);
  621.  
  622.    CoorY= 132;
  623.    Superf= Sup;
  624.    TransferBuffer= tmpEje= &Sup->EjeGiro;
  625. }
  626.  
  627. BOOL TDlgEjeGiro::CanClose()
  628. {
  629.    TDatEje DatTmp;
  630.  
  631.    TransferBuffer= &DatTmp;
  632.    TransferData(TF_GETDATA);
  633.    TransferBuffer= tmpEje;
  634.  
  635.    int Error= Superf->InitEjeGiro(&DatTmp);
  636.  
  637.    if(Error)
  638.    {
  639.       Mensaje(HWindow,Error);
  640.       return FALSE;
  641.    }
  642.    return TRUE;
  643. }
  644.  
  645. void TDlgEjeGiro::TipoEje(RTMessage)
  646. {
  647.    int Act1= ((TBRadioButton*)ChildWithId(rb2))->GetCheck();
  648.    int Act2= ((TBRadioButton*)ChildWithId(rb1))->GetCheck() || Act1;
  649.    int Act3= !Act2;
  650.  
  651.    EnableWindow(GetDlgItem(HWindow,edPnt1X), Act1);
  652.    EnableWindow(GetDlgItem(HWindow,edPnt1Y), Act1);
  653.    EnableWindow(GetDlgItem(HWindow,edPnt1Z), Act1);
  654.  
  655.    EnableWindow(GetDlgItem(HWindow,edPnt2X), Act2);
  656.    EnableWindow(GetDlgItem(HWindow,edPnt2Y), Act2);
  657.    EnableWindow(GetDlgItem(HWindow,edPnt2Z), Act2);
  658.  
  659.    EnableWindow(GetDlgItem(HWindow,edVarX), Act3);
  660.    EnableWindow(GetDlgItem(HWindow,edVarY), Act3);
  661.    EnableWindow(GetDlgItem(HWindow,edEjeX), Act3);
  662.    EnableWindow(GetDlgItem(HWindow,edEjeY), Act3);
  663.    EnableWindow(GetDlgItem(HWindow,cb1),    Act3);
  664. }
  665.  
  666.  
  667. /* TDlgTipoSup */
  668.  
  669. TDlgTipoSup::TDlgTipoSup(PTWindowsObject parent, TTipoSup *Tipo, PTModule module)
  670.             :TWindDlg(parent, dgTipoSup, module)
  671. {
  672.    TGroupBox *Grupo;
  673.  
  674.    Grupo= new TGroupBox(this,grPersp);
  675.    new TBRadioButton(this,rb1,Grupo);
  676.    new TBRadioButton(this,rb2,Grupo);
  677.  
  678.    TransferBuffer= Tipo;
  679. }
  680.  
  681.  
  682. /* TDlgFuncDef */
  683.  
  684. TDlgFuncDef::TDlgFuncDef(PTWindowsObject parent, int Y, PTModule module)
  685.             :TWindDlg(parent, dgFuncDef, module)
  686. {
  687.    CoorY= Y;
  688. }
  689.  
  690.  
  691. /* TFuncion */
  692.  
  693. void TFuncion::MensajeError(LPSTR Mens)
  694. {
  695.    char *Str= new char[256];
  696.    char *Pnt= Str;
  697.    int   Cont= 0;
  698.  
  699.    do{
  700.       if(Cont++== 25)
  701.       {
  702.          Cont= 0;
  703.          if(*Mens!= ' ')
  704.             *Pnt++= ' ';
  705.       }
  706.       *Pnt++= *Mens;
  707.    }while(*Mens++ != '\0');
  708.    ::Mensaje(NULL, Str);
  709.    delete Str;
  710. }
  711.